#include "AppDelegate.h"
#include "Config.h"
#include "PrototypeLayer.h"

USING_NS_CC;

AppDelegate::AppDelegate() {
}

AppDelegate::~AppDelegate() {
}

bool AppDelegate::applicationDidFinishLaunching() {
	cocos2d::CCDirector *director = cocos2d::CCDirector::sharedDirector();
	cocos2d::CCEGLView *eglView = cocos2d::CCEGLView::sharedOpenGLView();

	director->setOpenGLView(eglView);

	eglView->setDesignResolutionSize(DESIGN_RESOLUTION_SIZE.width, DESIGN_RESOLUTION_SIZE.height, kResolutionNoBorder);

	std::vector<std::string> searchPaths;
	searchPaths.push_back("data");
	cocos2d::CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
	director->setContentScaleFactor(1.0f);

	//turn on display FPS
	director->setDisplayStats(true);

	director->setAnimationInterval(1.0/60);

	//create scene here
	cocos2d::CCScene *scene = PrototypeLayer::Scene();

	director->runWithScene(scene);

	return true;
}

void AppDelegate::applicationDidEnterBackground() {
	CCDirector::sharedDirector()->stopAnimation();
}

void AppDelegate::applicationWillEnterForeground() {
	CCDirector::sharedDirector()->startAnimation();
}
